import http from '/@/utils/http';

/**
 * 知识库api接口集合
 * @method addKnowledgeApi 添加知识库文件
 * @method getLastVersionByDirIdApi 根据文件夹id获取最新一个版本的信息
 * @method editKnowledgeApi 编辑知识库文件
 * @method deleteDirApi 删除知识库文件
 * @method renewVersionApi 版本更新
 * @method deleteFileApi 删除文件
 * @method downloadFileApi 下载文件
 * @method downloadDirApi 下载所有版本文件
 */

export const addKnowledgeApi = async (params: any) => {
  return await http.post(`/system/mobile/sysKnowledge/addKnowledge`,params)
}

export const getLastVersionByDirIdApi = async (dirId: any) => {
  return await http.get(`/system/mobile/sysKnowledge/getLastVersionByDirId/${dirId}`)
}

export const editKnowledgeApi = async (params: any) => {
  return await http.put(`/system/mobile/sysKnowledge/editKnowledge`,params)
}

export const deleteDirApi = async (dirId: any) => {
  return await http.delete(`/system/mobile/sysKnowledge/deleteDir/${dirId}`)
}

export const renewVersionApi = async (params: any) => {
  return await http.put(`/system/mobile/sysKnowledge/renewVersion`,params)
}

export const deleteFileApi = async (params: any) => {
  return await http.delete(`/system/mobile/sysKnowledge/deleteFile/${params}`)
}

export const downloadFileApi = async (params: any) => {
  return await http.getDown(`/user/upload/downloadFile?fileUrl=${params}`)
}

export const downloadDirApi = async (dirId: any) => {
  return await http.get(`/system/mobile/sysKnowledge/downloadDir/${dirId}`)
}